# Maintainer: Johannes Findeisen <you@hanez.org>
pkgname=daemontools
pkgver=0.76
pkgrel=2
pkgdesc="Collection of tools for managing UNIX services"
url="https://cr.yp.to/daemontools.html"
arch="all"
license="Public-Domain"
depends=
# The makefile need GNU cat for 'cat -v'
makedepends="coreutils"

source="https://cr.yp.to/daemontools/$pkgname-$pkgver.tar.gz
	0.76-errno.patch
	0.76-warnings.patch
	svscan.initd
	"

builddir="$srcdir"/admin/$pkgname-$pkgver/src

build() {
	cd "$builddir"
	echo "${CC:-"gcc"} ${CFLAGS}" > conf-cc
	echo "${CC:-"gcc"} ${LDFLAGS}" > conf-ld
	touch home
	make PATH="/usr/bin:/bin" || return 1
}

package() {
	local f
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/bin "$pkgdir"/service
	for f in $(cat ../package/commands); do
		cp $f "$pkgdir"/usr/bin/$f
	done
	install -Dm755 "$srcdir"/svscan.initd "$pkgdir"/etc/init.d/svscan
}

sha512sums="e4a7938352b745a03ccc41acdddba1e6782f0ca245e5cae060de62ab6c5a23c841a994c30140298d274405a7f26d53ba7e84e5810a3d185b2c01e4c0feffe6c7  daemontools-0.76.tar.gz
76664b71e16ba4dbb081604a1a8c9ddc58a603777dccc0a53b0af9442ff8f0cdfce9ef8b05926dac62b81b2c805262df6a7e4df65920c00583132dbf136ba85e  0.76-errno.patch
13288c5d1fc5f775cff9286b5cb4c711c5e6e52ef9c714b377cec0328c887b065385c464ca27b2dbe921e66956c20b5f3205cc36d7d2e81c383b5765cbd554aa  0.76-warnings.patch
a2c3b35c7d253b9f2ffc5051663fdfacc5bd57385ce95d5d623f1f773d7bfe445b6837c7c1fe5565587387bdee0437761272f06902e166e95e2d00c19f8c6995  svscan.initd"
